#pragma once

#include <SDL_ttf.h>
#include "scr_resource.h"

class SCRResourceManager;

namespace SCRFontType
{
	typedef int Enum;
	const Enum SOLID = 0;
	const Enum SHADED = 1;
	const Enum BLENDED = 2;
}

namespace SCRFontAlign
{
	typedef int Flag;
	const Flag LEFT = 0;
	const Flag TOP = 0;
	const Flag CENTER_X = 1;
	const Flag CENTER_Y = 2;
	const Flag RIGHT = 4;
	const Flag BOTTOM = 8;
}

class SCRFont
	: public SCRResource
{
public:

	virtual ~SCRFont();
	void Draw(const int& X, const int& Y, const std::string& Text, 
		const SCRFontType::Enum& Type = SCRFontType::SOLID, 
		const SCRFontAlign::Flag& Align = SCRFontAlign::LEFT | SCRFontAlign::TOP);
	void SetColor(const unsigned char& Red, const unsigned char& Green, const unsigned char& Blue);
	void SetBackgroundColor(const unsigned char& Red, const unsigned char& Green, const unsigned char& Blue);
	TTF_Font* GetData() const;
	int GetSize() const;

	friend class SCRResourceManager;

private:

	SCRFont(const std::string& Filename, const int& Size);

	TTF_Font* m_pFont;
	int m_Size;
	unsigned int m_Color;
	unsigned int m_BackgroundColor;
};

inline void SCRFont::SetColor(const unsigned char& Red, const unsigned char& Green, const unsigned char& Blue)
{
	m_Color = (Red << 16) | (Green << 8) | Blue;
}

inline void SCRFont::SetBackgroundColor(const unsigned char& Red, const unsigned char& Green, const unsigned char& Blue)
{
	m_BackgroundColor = (Red << 16) | (Green << 8) | Blue;
}

inline TTF_Font* SCRFont::GetData() const
{
	return m_pFont;
}

inline int SCRFont::GetSize() const
{
	return m_Size;
}
